package ch03.acXml.ac1;

/**
 * @auth 邝志豪
 * @date 2024/1/8 16:56
 */
public class ComputeFactory {
    public static AbstractCompute getInstance(int algorithm){
        switch(algorithm){
            case 1:
                return new AdditiveMode();
            case 2:
                return new SubstractionMode();
            case 3:
                return new MultiplicationMode();
            case 4:
                return new DivisionMode();
            default :
                throw new RuntimeException("无效的数据库类型："+algorithm+",DAO获取失败");
        }
    }
}
